package sli.sli2.channels;

import java.io.BufferedReader;

import java.io.IOException;
import java.io.PrintWriter;

/**
 * Provides ways to send and receive messages over a TCP-socket
 * @author Group 8, Khassraf Roman, Mueller Robin, Zischka Stefan
 *
 */
public class TCPChannel implements Channel {
	
	private BufferedReader in;
	private PrintWriter out;
	
	public TCPChannel(BufferedReader in, PrintWriter out){
		this.in = in;
		this.out = out;
	}

	@Override
	public void send(byte[] message) {
		out.println(new String(message));
	}

	@Override
	public String receive() throws IOException {
		return in.readLine();
	}

}
